﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using Shop.Model;
using Shop.Framework.Services;

namespace Shop.Framework.Page {
    public class CMS_ProductListPage : ViewPage {

        public int TotalPage { get; set; }
        public int CurrentPage { get; set; }
        public int IdCategory { get; set; }
        public List<Product> ProductList { get; set; }
        public Category CurrentCategory { get; set; }

        protected override void OnInit(EventArgs e) {
            try {
                TotalPage = Convert.ToInt32(ViewData["TotalPage"]);
                CurrentPage = Convert.ToInt32(ViewData["CurrentPage"]);
                IdCategory = Convert.ToInt32(ViewData["IdCategory"]);
                CurrentCategory = (new CategoryService()).GetCategoryById(IdCategory);
                ProductList = ViewData["ProductList"] as List<Product>;                
            } catch (Exception ex) {
                throw ex;
            }
            base.OnInit(e);
        }

    }
}
